home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16331 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news.nyu.edu!schonberg!dewar
  2. From: dewar@cs.nyu.edu (Robert Dewar)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
  4. Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
  5. Date: 10 Apr 1996 07:42:08 -0400
  6. Organization: Courant Institute of Mathematical Sciences
  7. Message-ID: <dewar.829136485@schonberg>
  8. References: <JSA.96Feb16135027@organon.com> <dewar.829048603@schonberg> <4kets3$ic0@news-s01.ny.us.ibm.net> <dewar.829101156@schonberg> <4kfbm9$ea2@solutions.solon.com>
  9. NNTP-Posting-Host: schonberg.cs.nyu.edu
  10. X-Newsreader: NN version 6.5.0 (NOV)
  11.  
  12. Peter wrote
  13.  
  14. >I suspect what you're seeing is an obvious bug in their specs.  As
  15. >written, the spec on at least one system also guarantees not to give
  16. >a fault for
  17. >        char buf;
  18. >        read(fd, &buf, 1000);
  19. >even if there are 1000 bytes available, because the check is only specified
  20. >for whether the pointer given points to a valid object.
  21.  
  22.   No, that's incorrect. All versions of the spec that I have read are
  23.   quite clear that this call would cause undefined overwriting of data.
  24.   I say clear here in an informal sense, since these are of course
  25.   informal specs, but no one could read any of these specs and have
  26.   any question but that the above has undefined behavior if 1000 bytes
  27.   are read. I think Peter is misreading the spec here, deliberately
  28.   or otherwise.
  29.  
  30. >I doubt it.  I would bet that whoever wrote it did not give adequate
  31. >consideration to it, and did not check the spec in any detail.
  32.  
  33.   You would be quite wrong, and you would lose your bet. Some programmers
  34.   are very aware of specifications as they program! The actual thought
  35.   process here was very definitely a concious observation that the last
  36.   call was "safe" because it could not overwrite data, and an assumption
  37.   that overwriting data was the only undefined semantics involved.
  38.  
  39.  
  40.